package color.koitq.picker.view

import android.annotation.SuppressLint
import android.content.Context
import android.view.View
import android.widget.TextView
import color.koitq.picker.R
import com.skydoves.multicolorpicker.ColorEnvelope
import com.skydoves.multicolorpicker.FlagView


class CustomFlag(context: Context, layout: Int) : FlagView(context, layout) {

    private val textView: TextView = findViewById(R.id.flag_color_code)
    private val view: View = findViewById(R.id.flag_color_layout)

    @SuppressLint("SetTextI18n")
    override fun onRefresh(envelope: ColorEnvelope) {
        this.textView.text = "#${envelope.htmlCode}"
        this.view.setBackgroundColor(envelope.color)
    }
}
